#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
//http://www.oj7.cn/
int n, arr[100000], target
;

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> arr[i];
	}

	int l = 1;
	int r = n;
	int m = 0.5 * (l + r);
	cin >> target;
	if (arr[n] == target)
	{
		cout << n << endl;
		return 0;
	}
	if (arr[1] == target)
	{
		cout << 1 << endl; return 0;
	}
	while (l<r-1)
	{
		if (arr[m] < target)
		{
			l = m;

		}
		else if (arr[m] > target)
		{
			r = m;
		}
		else if (arr[m] == target)
		{
			cout << m << endl;
			return 0;
		}
		m = (l + r) / 2;
	}
	
	cout << -1 << endl;
	return 0;

	return 0;
}